<template>
  <div>
    <el-dialog :title="title" :visible.sync="$parent.open">
      <el-descriptions>
        <el-descriptions-item label="位置编号">{{ rowObj.placeNum }}</el-descriptions-item>
        <el-descriptions-item label="位置名称">{{ rowObj.placeName }}</el-descriptions-item>
      </el-descriptions>
      <el-table :data="tableData" v-loading="loading">
        <el-table-column property="equipmentNum" label="设备编号" min-width="130"></el-table-column>
        <el-table-column property="assetNum" label="资产编号" min-width="130"></el-table-column>
        <el-table-column property="equipmentName" label="设备名称" min-width="130"></el-table-column>
        <el-table-column property="model" label="品牌" min-width="130"></el-table-column>
        <el-table-column property="brand" label="规格型号" min-width="130"></el-table-column>
        <el-table-column property="placeName" label="位置" min-width="130"></el-table-column>
      </el-table>
      <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
        @pagination="getList" />
      <br>
      <div align="center">
        <el-button type="primary" @click="() => $parent.open = !$parent.open">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { placeaccountlist } from "@/api/equipment/equipment.js";
export default {
  props: ['title', 'rowObj'],
  data () {
    return {
      tableData: [],
      loading: false,
      // 总条数
      total: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        orderByColumn: 'equipmentAccountId',//排序字段
        isAsc: 'desc'//倒叙
      },
    }
  },
  created () {
    this.getList()
  },
  methods: {
    getList () {
      this.loading = true
      let params = {
        ...this.queryParams,
        'params[type]': 1,//0区域，1位置
        'params[id]': this.rowObj.placeId,//位置ID
      }
      placeaccountlist(params).then(res => {
        this.tableData = res.data
        this.total = res.total
        this.loading = false
      }).catch(() => {
        this.loading = false
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>